package com.deyu.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.deyu.base.DaoSupportImpl;
import com.deyu.domain.Student;
import com.deyu.service.StudentService;
@Service
@Transactional
public class StudentServiceImpl extends DaoSupportImpl<Student> implements StudentService{


	@Override
	public Student findStudentByLP(String loginName, String password) {
		System.out.println("***********************1");
		Student student =(Student) getSession().createQuery(//
			      "FROM Student s WHERE s.loginName = ? AND s.pwd = ? ")//
			      .setParameter(0, loginName)//
			      .setParameter(1, password)//
			      .uniqueResult();
		System.out.println("***********************2"+student);
		return student;
	}

	@Override
	public Student findStudentById(Long id) {
		System.out.println("***********************");
		Student student =(Student) getSession().createQuery(//
			      "FROM Student s WHERE s.id = ?")//
			      .setParameter(0, id)//
			      .uniqueResult();
		System.out.println(student.toString());
		return student;
	}

}
